package github.sf.fw.tools.db.catalog.doris;

import github.sf.fw.tools.db.catalog.ColumnModel;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;


/**
 * @author zhoup
 * @since 2023/7/26
 */
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class DorisColumnModel extends ColumnModel {
    /**
     * Doris中的Aggregate description，对应到Doris表的数据模型为聚合模式时有用
     * 聚合描述
     */
    private String aggDesc;

    @Override
    public String getFragment() {
        emptyVerify(columnName, "列名不能为空");
        emptyVerify(columnType, "列类型不能为空");
        StringBuilder result = new StringBuilder(columnName + " " + columnType);
        if (aggDesc != null && !aggDesc.isEmpty()) {
            result.append(" ").append(aggDesc);
        }
       addPublicPart(result);
        return result.toString();
    }
}
